<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/My97DatePicker/WdatePicker.js"></script>
<div class="admin_nrtop">
    <div class="ad_search">
        <form action="/admini/task/completeuser/"  method="get" style="margin:0px" id="form1">
        <div class="search">
            <div class="soubox">
                <input type="text" id="quick" name="quick" value="<?php echo $this->quick?$this->quick:"";?>" placeholder="输入仓库号/用户名等"/>
                <input type="hidden" id="startTime" name="startTime" value="<?php echo $this->startTime?$this->startTime:"";?>" />
                <input type="hidden" id="endTime" name="endTime" value="<?php echo $this->endTime?$this->endTime:"";?>"/>
                <input type="hidden" id="taskId" name="taskId" value="<?php echo $this->taskId?$this->taskId:"";?>"/>
            </div>
            <a href="javascript:$('#form1').submit();"><span>搜索</span></a>
        </div>
        <div class="timebox">
            <div class="ad_time" style="width:310px;">
                <div class="timefw">
                    <div class="time">
                        <!--点击后悬停样式为：<div class="timeselect t_on">-->
                        <div class="timeselect"  id="stime">
                            <span id="stimeval"><?php echo $this->starttime?$this->starttime:date("Y-m-d",mktime(0,0,0,date("m"),date("d")-90,date("Y")));?></span><i></i>
                        </div>
                        <div class="timeslelctbox">
                            <!---时间插件放此DIV-->
                        </div>
                    </div>
                    <div class="timezhi">
                        <span>至</span>
                    </div>
                    <div class="time" >
                        <div class="timeselect" id="etime">
                            <span id="etimeval"><?php echo $this->endtime?$this->endtime:date("Y-m-d");?></span><i></i>
                        </div>
                        <div class="timeslelctbox">
                            <!---时间插件放此DIV-->
                        </div>
                    </div>
                </div>
            </div>
            <div class="timeok">
                <a href="javascript:$('#form1').submit();">确定</a>
            </div>
        </div>
        </form>
    </div>
</div>
<div  class="biaoge">
    <div class="biaotbody">
        <table>
            <tr>
                <th class="li3">
                    <div class="lileft">&nbsp;</div>
                </th>
                <th class="li20">
                    <div class="biaoxiala">
                        <div class="lixiala">
                            <span>任务内容</span>
                            <i></i>
                        </div>
                        <div class="biaoxllb" style="display:none;">
                            <ul>
                                <?php if($this->taskAll){ foreach ($this->taskAll as $taskVal) { ?>
                                    <li><a href="javascript:settask(<?php echo $taskVal->Id; ?>)"><?php echo $taskVal->Name; ?></a></li>
                                <?php }} ?>
                            </ul>
                        </div>
                    </div>
                </th>
                <th class="li8">
                    <div class="lileft"><span>用户名</span></div>
                </th>
                <th class="li8">
                    <div class="lileft"><span>仓库号</span></div>
                </th>
                <th class="li8">
                    <div class="lileft"><span>用户成长值</span></div>
                </th>
                <th class="li8">
                    <div class="lileft"><span>完成时间</span></div>
                </th>
            </tr>
        </table>
    </div>
    <?php if($this->taskId){?>
        <div class="xzinfo">
          <ul>
              <?php if($this->taskId){ ?><li><div class="xzinfobox"><span><?php $taskItem=Application_Model_Task::load($this->taskId);echo $taskItem->Name;?></span><a href="javascript:removeset('taskId')" title="撤销"><i>撤销</i></a></div></li><?php }?> 
          </ul>
        </div>
     <?php }?>
     <div class="table">
         <table>
             <?php  if($this->completeList){
                foreach ($this->completeList as $Item) { ?> 
                 <tr id="tr_<?php echo $Item->id;?>">
                     <td class="li3">&nbsp;</td>
                     <td class="li20">
                         <div class="lileft">
                             <?php echo $Item->TaskName;?>
                         </div>
                     </td>
                     <td class="li8">
                         <div class="lileft">
                             <?php echo $Item->UserInfo->Nikename;?>
                        </div>
                     </td>
                     <td class="li8">
                         <div class="lileft">
                             <?php echo $Item->UserInfo->Storeno;?>
                        </div>
                     </td>
                     <td class="li8">
                         <div class="lileft">
                             <?php echo $Item->UserInfo->Account->Score;?>
                        </div>
                     </td>
                     <td class="li8">
                         <div class="lileft">
                             <?php echo $Item->DateCreated;?>
                        </div>
                     </td>
                 </tr>
             <?php } }  if(!$this->completeList){
                echo "<font size='4' color='red'>暂无数据</font>";
                }?>   
         </table>
     </div>
 </div>
<div class="toolbar">
<?php
    echo $this->partial('paging.phtml', array("pages" => $this->completeAll,"pamas"=>"name=$this->name&typeid=$this->typeid&status=$this->status"));        
?>
</div>
<script>
    $(".lixiala").click(function(){
        $(".lixiala").attr("class","lixiala");
        $(".lixiala").next("div").attr("style","display:none;");
    
        $(this).attr("class","lixiala bton");
        $(this).next("div").attr("style","display:block;");
    });
    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".biaoxiala").length == 0){
            $(".lixiala").attr("class","lixiala");
            $(".lixiala").next("div").attr("style","display:none;");
        }
    });
    function settask(taskId)
    {
        $("#form1 #taskId").val(taskId);
        $("#form1").submit();
    }
    function removeset(set)
    {
        $("#form1 #"+set).val("");
        $("#form1").submit();
    }
    $("#stime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'stimeval',vel:'startTime',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
                $(".soubox #timescope").val("");
        }});
    });
    $("#etime").click(function(){
        $(this).attr("class","timeselect t_on");
        WdatePicker({el:'etimeval',vel:'endTime',onpicked:function(){
                $("#stime,#etime").attr("class","timeselect");
                $(".soubox #timescope").val("");
        }});
    });
</script>
